<?php
namespace app\backstage\model;

use think\Db;
use think\Model;

class BackhaulLog extends Model
{
    protected $table = 'quick_backhaul_log';

    /*获取列表记录*/
    public function getList($where, $field = '*', $page = 1, $pageSize = 100, $orderBy = [], $groupBy = '')
    {
        $list = Db::table($this->table)->where($where)->field($field)
            ->page($page, $pageSize)->order($orderBy)->group($groupBy)->select();

        return $list ? $list : [];
    }

    /*获取总记录数*/
    public function getTotalNumber($where = [], $groupBy = '')
    {
        $count = Db::table($this->table)->where($where)->group($groupBy)->count('id');
        return $count;
    }

    /*添加记录*/
    public function insertRecord($data)
    {
        $res = Db::table($this->table)->insert($data);
        return $res > 0 ? true : false;
    }

}